#ifndef PORTAL_H
#define PORTAL_H

#include <fstream>
#include <string>

#include "SFML/System.hpp"


class Portal
{
public:
	Portal();
	Portal(const std::string& destLevel, const sf::Vector2f& sourcePos, const sf::Vector2f& destPos);

    friend bool operator==(const Portal& lhs, const Portal& rhs);
    friend bool operator!=(const Portal& lhs, const Portal& rhs);

	//virtual void readElement(ticpp::Element* element);
    //virtual void writeElement(ticpp::Element* element) const;

	const std::string& getDestLevel() const;
	const sf::Vector2f& getSourcePos() const;
	const sf::Vector2f& getDestPos() const;
private:
	std::string destLevel;
	sf::Vector2f sourcePos, destPos;
};

class FromPosEqual
{
public:
    FromPosEqual(const sf::Vector2f& point)
    : point(point)
    {
    }

    bool operator()(const Portal& portal)
    {
        return portal.getSourcePos() == point;
    }
private:
    const sf::Vector2f& point;
};

class ToPosEqual
{
public:
    ToPosEqual(const sf::Vector2f& point)
    : point(point)
    {
    }

    bool operator()(const Portal& portal)
    {
        return portal.getDestPos() == point;
    }
private:
    const sf::Vector2f& point;
};

#endif